import Vue from 'vue';
import './importStyle';
import install from '@/static/js/install/index.js';
import store from '@/store/index'
import createRouter from './createRouter';
import ElementUI from 'element-ui';
import BaseUI from '@/components/install.js';
import Layout from '@/components/layout/base-layout.vue'
import i18n from "@/static/lang/index.js";

Vue.use(install);
Vue.use(BaseUI);
Vue.use(ElementUI, {
    i18n: (key, value) => i18n.t(key, value)
});

export default function (router, option) {
    option = option || {};
    let defaultOption = {
        attrs: option.attrs || {},
    }
    let routerApp = createRouter(router.routes)

    let vueOption = {
        router: routerApp,
        store,
        i18n,
        render: h => h(Layout, {
            attrs: {
                attrs: defaultOption.attrs,
            }
        }),
    }
    if(option.render) vueOption.render = option.render;

    new Vue(vueOption).$mount('#app');
}